package com.ocean.productCheck.service.impl;

import com.ocean.common.core.domain.entity.SysUser;
import com.ocean.common.core.text.Convert;
import com.ocean.common.utils.ShiroUtils;
import com.ocean.common.utils.uuid.IdUtils;
import com.ocean.product.service.IOProductService;
import com.ocean.productCheck.domain.OProductCheckSms;
import com.ocean.productCheck.mapper.OProductCheckSmsMapper;
import com.ocean.productCheck.service.IOProductCheckSmsService;
import com.ocean.system.service.ISysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author msy
 * @date 2023/2/17
 */
@Service
public class OProductCheckSmsServiceImpl implements IOProductCheckSmsService {

    @Autowired
    private OProductCheckSmsMapper oProductCheckSmsMapper;

    @Override
    public int insertOProductCheckSms(OProductCheckSms productCheckSms) {
        productCheckSms.setId(IdUtils.simpleUUID());
        return oProductCheckSmsMapper.insertOProductCheckSms(productCheckSms);
    }

    @Override
    public List<OProductCheckSms> getFormList(OProductCheckSms checkSms) {
        return oProductCheckSmsMapper.selectOProductCheckSmsFormList(checkSms);
    }

    @Override
    public int deleteByIds(String ids) {
        return oProductCheckSmsMapper.deleteOProductCheckSmsByIds(Convert.toStrArray(ids));
    }

    @Override
    public List<OProductCheckSms> selectOProductCheckSmsList(OProductCheckSms opcs) {
        return oProductCheckSmsMapper.selectOProductCheckSmsList(opcs);
    }

    @Override
    public int updateOProductCheckSms(OProductCheckSms productCheckSms) {
        SysUser sysUser = ShiroUtils.getSysUser();
        productCheckSms.setUpdateDate(new Date());
        productCheckSms.setUpdateName(sysUser.getUserName());
        productCheckSms.setUpdateBy(sysUser.getLoginName());
        return oProductCheckSmsMapper.updateOProductCheckSms(productCheckSms);
    }

}
